<template>
    <input type="text" v-model.trim="sse">
</template>
<script>
    const delay = (function () {
        let timer = 0
        return function (callback, ms) {
            clearTimeout(timer)
            timer = setTimeout(callback, ms)
        }
    })()
    export default {
        name: 'search',
        watch: {
            sse() {
                delay(() => {
                    this.search()
                }, 500)
            },

        },
        methods: {
            search() {
                this.$axios
                    .get([url])
                    .then(response => {
                        // success
                    })
                    .catch(error => {
                        // error
                        alert('失败！')
                    })
            }
        }
    }
</script>